package homework.work10;

import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Random random = new Random();

        // 生成一个介于0到100之间的随机整数
        int randomNumber = random.nextInt(101);
        Scanner scanner = new Scanner(System.in);
        boolean flag=true;
        while(flag){
            int temp = scanner.nextInt();
            if(temp<0||temp>100){
                System.out.println("Illegal input, please re-enter");
                continue;
            }
            if(temp==randomNumber){
                System.out.println("Congratulations, you got it");
                break;
            } else if (temp<randomNumber) {
                System.out.println("Your guess is too small");
            }else{
                System.out.println("Your guess is too much");
            }
        }
    }
}
